/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package fr.ove.openmath.jome.ctrlview.events;

/**
 *
 * @author Mr.Sam
 */
import java.util.EventObject;

/**
* The event to send to all objects that implements the interface ControlListener
* and which want to execute the control actions.
*
* @author © 1998 DIRAT Laurent
* @version 1.0  09/07/98
*/
public class ControlEvent extends EventObject {
    /**
    * The action to execute with the event.
    */
    private int action;

    /**
    * The argument of the action to execute.
    */
    private Object argument;

    /**
    * The constructor.
    * @param src the object which produces this event.
    */
    public ControlEvent(Object src) {
        super(src);
    }

    /**
    * Sets the action and its argument, if necessary, to execute to the event.
    * @param action the action to execute.
    * @param argument the action argument. If the action don't need
    * an argument, it must be sets to <CODE>null</CODE>.
    */
    public void setAction(int action, Object argument) {
        this.action = action;
        this.argument = argument;
    }

    /**
    * Returns the action associated with the event.
    */
    public int getAction() {
        return action;
    }

    /**
    * Returns the argument of the action.
    */
    public Object getArgument() {
        return argument;
    }

    /**
    * The different actions associated with the event.<BR>
    */

    /**
    * Add the element which produces the event.
    */
    public static final int ADD                 = 0;

    /**
    * Remove the element which produces the event.
    */
    public static final int REMOVE              = 1;

    /**
    * Iconify the element which produces the event.
    */
    public static final int ICONIFY             = 2;

    /**
    * Uniconify the element which produces the event.
    */
    public static final int UNICONIFY           = 3;

    /**
    * Recursive iconification
    */
    public static final int UNICONIFY_ALL       = 4;

    /**
    * Substitue the selection by a friendly name.
    */
    public static final int SUBSTITUTE          = 5;

    /**
    * Ask the OpenMath object of the formula.
    */
    public static final int GIVE_OPENMATH       = 6;

    /*
    * Ask the maple-like expression of the formula.
    */
    public static final int GIVE_MAPLE          = 7;
    
}

